﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ZK.HardWareBLL;
using ZK.InterfaceServer;

namespace ZK.YHP_TransManage.Test
{
    public partial class 煤管票测试 : Form
    {
        public 煤管票测试()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Models.CMTM.CpSendMM sendm = new Models.CMTM.CpSendMM()
            {
                mScaleNum = 2,
                mCard = "12121212",
                mCNumber = "sasd",
                mTare = 12.34f
            };
            CMTServer.SendCP(sendm);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Models.CMTM.WCXSSendM sendm = new Models.CMTM.WCXSSendM()
            {
                mCname = "司机姓名",
                mSort = "三八块",
                mTarget = "卸货地址",
                mCtype = "车型",
                mType = "",
                uuid = "12",
                mPrice = 123.2f,
                mNt = 23f,
                mGr = 23.45f,
                mCNumber = "车牌"
            };

            CMTServer.SendWCXS(sendm);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Models.CMTM.CpSendMM sendm = new Models.CMTM.CpSendMM()
            {
                mScaleNum = 2,
                mCard = "12121212",
                mCNumber = "sasd",
                mTare = 12.34f
            };
            var a = CMTServer.SendCP(sendm);

            if (a.errorMsg != "OK")
            {
                MessageBox.Show(a.errorMsg);
            }
            Models.CMTM.WCXSSendM sendm2 = new Models.CMTM.WCXSSendM()
            {
                mCname = "司机姓名",
                mSort = "三八块",
                mTarget = "卸货地址",
                mCtype = "车型",
                mType = "",
                uuid = a.uuid,
                mPrice = 123.2f,
                mNt = 23f,
                mGr = 23.45f,
                mCNumber = "车牌"
            };

            var a2 = CMTServer.SendWCXS(sendm2);
            if (a2.errorMsg != "OK")
            {
                MessageBox.Show(a.errorMsg);
            }

            MessageBox.Show("完美");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            string b;
            string a = "";
            if (string.IsNullOrEmpty(a))
            {
                b = a ?? "123";
            }


            #region 老煤管票系统
            bool res = CMTServer.SendOld(new Models.CMTM.OldM()
            {
                mCname = "sjxm",
                mCNumber = "陕A11111",
                SN = "1",
                mSort = "三八块",
                mCtype = "半挂",
                mGr = 46,
                mTare = 15,
                mTarget = "陕西",
                mType = "三八块"
            });
            if (!res)
            {
                MessageBox.Show("境外票通讯错误");
            }
            #endregion
        }
    }
}
